/**
 * 
 */
package org.sunnyleaf.votedemo;

import java.security.MessageDigest;

/**
 * @author Administrator
 * 
 */
public class Utils {

	public static String sha1(String src) {
		StringBuffer res = new StringBuffer();
		try {
			MessageDigest md = MessageDigest.getInstance("SHA-1");
			byte[] re = md.digest(src.getBytes());
			for(int i = 0; i<re.length;i++){
				res.append(Integer.toHexString(re[i]));
			}
			return res.toString();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}

	}
}
